package com.wanban.txplayertest

import android.os.Bundle
import android.util.Log
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.rabbit.videoplayer.MixPlayerView
import com.rabbit.videoplayer.response.VideoPlayModel
import com.wanban.downloader.MultiDownloadManager
import com.wanban.downloader.db.DownloadEntity

class VideoPlayerActivity: AppCompatActivity() {

    private lateinit var videoPlayer: MixPlayerView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.actiity_video)
        videoPlayer = findViewById(R.id.videoView)

        val task = (intent.getSerializableExtra("task") as DownloadEntity?)?:return

        val url = task.filePath
        Log.e("下载地址", "url -> " + url)
        // 重置广告标签
        videoPlayer.playVideo(
            // 播放url
            url!!,
            "下载",
            // 跳转进度
            startPosition = 0,
            0,
            1,
            isPlayDownloadVideo = false,
        )
    }


    override fun onPause() {
        super.onPause()
        videoPlayer.onVodSuspend()
    }

    override fun onResume() {
        super.onResume()
        videoPlayer.onVodResume()
    }

    override fun onDestroy() {
        super.onDestroy()
        videoPlayer.release()
    }

}